<?php //ver.2011 0.1 - Eugenio Ghiglia <eugenio@blux.org> - 

$ext2mime["cdra"]="image/x-coreldraw";
$ext2mime["tif"]="image/tiff";
$ext2mime["gif"]="image/gif";
$ext2mime["jpg"]="image/jpeg";
$ext2mime["jpeg"]="image/jpeg";
$ext2mime["png"]="image/png";
$ext2mime["ico"]="image/x-ico";
$ext2mime["bmp"]="image/x-ms-bmp";

include("../settings.php");
require_once("../lib/class.db.php");
$db = new Db();
$db->type='mysql';
$db->error_off();
if (!$db->connetti($_db_host, $_db_user, $_db_psw, $_db_name)) {
        die('ERRORE');
}
$sql="SELECT immagine FROM tbl_annunci WHERE id_annuncio='".(int)$_GET['id']."'";
$db->sql_arr($sql,$record,$n);
$img=unserialize($record[0]['immagine']);
header('Content-type: '.$ext2mime[$img['type']]);
echo base64_decode($img['b64']);
?>
